package com.itany.corejava.code08_常用类.日期类;

import com.itany.corejava.util.DateUtil;

import java.text.ParseException;
import java.util.Date;

/**
 * @author MissChen
 * @version 1.0
 * @date 2023 年11月14日 16:08
 */



public class Test04_练习 {
    public static void main(String[] args) throws ParseException {
        Date date=new Date();
        System.out.println(DateUtil.toString(date));

        System.out.println(DateUtil.toString(date,"yyyy年MM月dd日 HH:mm:ss"));

        String dateStr1="2023-11-11 11:11:11";
        System.out.println(DateUtil.toDate(dateStr1));

        System.out.println(DateUtil.toDate("2023年12月12日","yyyy年MM月dd日"));

        System.out.println("--------------------");
        Date yesterday=DateUtil.getYesterday(date);
        System.out.println(yesterday);

        Date tomorrow=DateUtil.getTomorrowDay(date);
        System.out.println(tomorrow);

        System.out.println("------------------------");
        String begin="2023-11-11 12:12:12";
        String end="2023-11-15 20:12:12";
        Date beginDate=DateUtil.toDate(begin);//将字符串转换为日期
        Date endDate=DateUtil.toDate(end);
        int day=DateUtil.getDuringDay(beginDate,endDate);
        System.out.println(day);

        System.out.println("===============");
        DateUtil.get(date);

        int i=DateUtil.get2(date,3);
        System.out.println(i);


    }
}
